﻿using Compass.Wasm.Shared.Wms;
using Zack.DomainCommons.Models;

namespace Compass.WmsService.Domain.Entities;

public record Location : AggregateRootEntity
{
    public Warehouse_e Warehouse { get; private set; }
    public Area_e Area { get; private set; }

    public string Name { get; private set; }
    public string? Remarks { get; private set; }

    private Location() { }
    public Location(Guid id,Warehouse_e warehouse,Area_e area,string name,string? remarks)
    { 
        Id=id;
        Warehouse=warehouse;
        Area=area;
        Name=name;
        Remarks=remarks;
    }

    public void Update(LocationDto dto)
    {
        ChangeWarehouse(dto.Warehouse)
            .ChangeArea(dto.Area)
            .ChangeName(dto.Name)
            .ChangeRemarks(dto.Remarks);

        NotifyModified();
    }

    public Location ChangeWarehouse(Warehouse_e warehouse)
    {
        Warehouse=warehouse;
        return this;
    }
    public Location ChangeArea(Area_e area)
    {
        Area=area;
        return this;
    }
    public Location ChangeName(string name)
    {
        Name=name;
        return this;
    }
    public Location ChangeRemarks(string? remarks)
    {
        Remarks=remarks;
        return this;
    }
}